package com.qidianit.mes.device.controller;


import com.qidianit.common.pojo.MESResult;
import com.qidianit.mes.device.service.DeviceMaintainItemService;
import com.qidianit.mes.device.service.DeviceWorkShopService;
import com.qidianit.mes.pojo.DeviceMaintainItem;
import com.qidianit.mes.pojo.DeviceWorkshop;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/deviceMainItem")
@CrossOrigin
public class DeviceMaintainItemController {

    @Autowired
    DeviceMaintainItemService deviceMaintainItemService;
    @GetMapping("/list")
    public MESResult list(String projectCode,String projectName,String projectType,
            @RequestParam(defaultValue = "1")int page,
            @RequestParam(defaultValue = "10")int limit) {
        MESResult mesResult = deviceMaintainItemService.list(projectCode,projectName,projectType,page,limit);
        return mesResult;
    }

    @PostMapping("/add")
    public MESResult add(@RequestBody DeviceMaintainItem deviceMaintainItem){
        return deviceMaintainItemService.add(deviceMaintainItem);
    }
    @PostMapping("/edit")
    public MESResult edit(@RequestBody DeviceMaintainItem deviceMaintainItem){
        return deviceMaintainItemService.edit(deviceMaintainItem);
    }
    @DeleteMapping("/delete")
    public MESResult delete(String id){
        return deviceMaintainItemService.delete(id);
    }
}
